<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>componentlocal局部组件注册</title>
    <script src="https://cdn.bootcss.com/vue/2.6.10/vue.js"></script>
</head>
<body>
<div id="app">
    <model1></model1>
    <model1></model1>
    <model1></model1>
</div>
<hr/>
<div id="app1">
<!--    在这里使用组件<model1>浏览器控制台会报错，因model1 被绑定到了app中。-->
    <model1></model1>
    <model1></model1>
    <model1></model1>
</div>
</body>
<script>
    new Vue({
        el: "#app",
        components: {
            "model1": {
                template: "<div><h1>{{title}}</h1><button type='button' @click='btnfn'>点我</button></div>",
                data: function () {
                    return {
                        title: "hello vuevuevuelocal"
                    }
                },
                methods: {
                    btnfn: function () {
                        alert("Hello ~~~");
                    }
                }
            }
        }
    });

    new Vue({
        el: "#app1"
    })
</script>
</html>